__all__ = ['pats', 'exts']

import re

from lib import *

pats = EmptyObject()
pats.html = EmptyObject()

pats.html.tr = re.compile(r'''<tr\s+((?:[^'">]|(?:('|")(?:[^\2]|\\\2)*?\2))+)>((?:.|\n)+?)</tr>''')
# 1: tr attribute string, 2: -, 3: innerHTML of tr

pats.html.td = re.compile(r'''<td\s+((?:[^'">]|(?:('|")(?:[^\2]|\\\2)*?\2))+)>((?:.|\n)+?)</td>''')
# 1: td attribute string, 2: -, 3: innerHTML of td

pats.html.a = re.compile(r'''<a\s+((?:[^'">]|(?:('|")(?:[^\2]|\\\2)*?\2))+)>((?:.|\n)+?)</a>''')
# 1: <a> attribute string, 2: -, 3: innerHTML of <a>

pats.attr = re.compile(r'''((?:\w|-)+)=((?:('|")(?:[^\3]|\\\3)*?)\3|\W*)''')
# 1: attribute name, 2: attribute value (quote unstripped), 3: -

pats.url = re.compile(r'(?:(\w+:)?//(?:([^@]+)@)?([^?#@:/]+)(?:\:(\d+))?)?([^?#]*)?(\?[^#]*)?(#.*)?')
# 1: protocol, 2: username, 3: hostname, 4: port, 5: pathname, 6: search, 7: hash

exts = EmptyObject()

exts.img = {'.jpeg', '.jpg', '.png', '.gif', '.webp', '.tiff', '.bmp'}
